<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8" />
		<title>FIRST</title>
		<style type="text/css">
			*{
				padding: 0;
				margin: 0;
			}
			.container{
				width: 100vw;
				height: 100vh;
				display: flex;
				align-items: center;
				justify-content: center;
			}
		canvas{
			width: 400px;
			height: 400px;
			border: 10px solid #333333;
		}	
		
		</style>
	</head>
	<body>
		<div class="container">
		<canvas id="canvas" width="500" height="500"></canvas>
		</div>
	</body>
	<script>
		window.onload = function() {
			
			let oCanvas = document.getElementById('canvas');
		
			console.dir(oCanvas);
			
			let oPen=oCanvas.getContext("2d");
			
			//LineCap
			oPen.beginPath();
			oPen.lineWidth=20;
            oPen.lineCap="round";
            oPen.moveTo(20,20);
            oPen.lineTo(20,200);
            oPen.stroke();
            
            oPen.beginPath();
            oPen.lineWidth=20;
            oPen.lineCap="square";
            oPen.moveTo(60,20);
            oPen.lineTo(60,200);
            oPen.stroke();
            
            oPen.beginPath();
            oPen.lineWidth=20;
            oPen.lineCap="butt";
            oPen.moveTo(90,20);
            oPen.lineTo(90,200);
            oPen.stroke();
            
            oPen.beginPath()
			oPen.lineJoin = "bevel";
            oPen.moveTo(150,20);
            oPen.lineTo(250,20);
            oPen.lineTo(250,100);
            oPen.stroke();
            
            oPen.beginPath()
            oPen.lineJoin = "round";
            oPen.moveTo(300,20);
            oPen.lineTo(400,20);
            oPen.lineTo(400,100);
            oPen.stroke();
            
            oPen.beginPath()
            oPen.lineJoin = "miter";
            oPen.moveTo(150,150);
            oPen.lineTo(250,150);
            oPen.lineTo(250,250);
            oPen.stroke();
            
            let namber =[10,20,30,40];
            /**
             *定义数组->一个单元的循环，有色、无色、有色 ....
             */
            
            oPen.setLineDash(namber);
            oPen.moveTo(120,10);
            oPen.lineTo(120,300);
            oPen.stroke();
            
            
            
           }
	</script>
</html>
